package oop.core.parsers;

import java.util.Scanner;
import oop.core.map.Location;
/**
 * parses the Location class into the string format we were planning to use to save and load
 * the avatar data.
 * @author srhinson
 *
 */
public class LocationParser {
	static String del = "L~";
	
	public static String parseOut(Location location){
		String data = "";
		data=data.concat(location.getXPos()+"L~");
		data=data.concat(Integer.toString(location.getYPos()));
		return data;
	}
	
	public static Location parseIn(String data){
		Scanner scanner = new Scanner(data);
		scanner.useDelimiter(del);
		return new Location(Integer.parseInt(scanner.next()), Integer.parseInt(scanner.next()));
	}

}
